SlideShare a Scribd company logo
1 of 22
Class No.22  Data Structures http://ecomputernotes.com
Deletion in AVL Tree ,[object Object],[object Object],[object Object],http://ecomputernotes.com
Deletion in AVL Tree Case 1a : the parent of the deleted node had a balance of 0 and the node was deleted in the parent’s  left  subtree. Action : change the balance of the parent node and stop. No further effect on balance of any higher node. Delete on this side http://ecomputernotes.com
Deletion in AVL Tree Here is why; the height of left tree does not change. 1 2 3 4 5 6 7 0 1 2 http://ecomputernotes.com
Deletion in AVL Tree Here is why; the height of left tree does not change. 1 2 3 4 5 6 7 2 3 4 5 6 7 0 1 2 remove(1) http://ecomputernotes.com
Deletion in AVL Tree Case 1b : the parent of the deleted node had a balance of 0 and the node was deleted in the parent’s  right  subtree. Action : (same as  1a )   change the balance of the parent node and stop. No further effect on balance of any higher node. Delete on this side http://ecomputernotes.com
Deletion in AVL Tree Case 2a : the parent of the deleted node had a balance of 1 and the node was deleted in the parent’s  left  subtree. Action : change the balance of the parent node. May have caused imbalance in higher nodes so continue up the tree. Delete on this side http://ecomputernotes.com
Deletion in AVL Tree Case 2b : the parent of the deleted node had a balance of -1 and the node was deleted in the parent’s  right  subtree. Action : same as 2a: change the balance of the parent node. May have caused imbalance in higher nodes so continue up the tree. Delete on this side http://ecomputernotes.com
Deletion in AVL Tree Case 3a : the parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was balanced. http://ecomputernotes.com
Deletion in AVL Tree Case 3a : the parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was balanced. Action : perform single rotation, adjust balance. No effect on balance of higher nodes so stop here. Single rotate http://ecomputernotes.com
Deletion in AVL Tree Case 4a : parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was unbalanced. http://ecomputernotes.com
Deletion in AVL Tree Case 4a : parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was unbalanced. Action : Double rotation at B. May have effected the balance of higher nodes, so continue up the tree. rotate double
Deletion in AVL Tree Case 5a : parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was unbalanced. http://ecomputernotes.com
Deletion in AVL Tree Case 5a : parent had balance of -1 and the node was deleted in the parent’s  left  subtree, right subtree was unbalanced. Action : Single rotation at B. May have effected the balance of higher nodes, so continue up the tree. rotate single
Other Uses of Binary Trees Expression Trees http://ecomputernotes.com
Expression Trees ,[object Object],[object Object],http://ecomputernotes.com
Expression Tree (a+b*c)+((d*e+f)*g) a c + b g * + + d * * e f http://ecomputernotes.com
Parse Tree in Compiler ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],<assign> <id> <expr> <expr> <term> <term> <term> <factor> C B * + <id> <id> A := A <id> <factor> <factor> A := A + B * C
Parse Tree for an SQL query Consider querying a movie database Find the titles for movies with stars born in 1960 The database has tables StarsIn(title, year, starName) MovieStar(name, address, gender, birthdate) SELECT title FROM StarsIn, MovieStar WHERE starName = name AND birthdate LIKE ‘%1960’ ; http://ecomputernotes.com
SQL Parse Tree < Query > SELECT  <SelList>  FROM  <FromList>  WHERE  <Condition> <Attribute> <RelName> , <FromList>  AND title   StarsIn  <RelName>  <Condition>   <Condition> <Attribute>  =  <Attribute> <Attribute>  LIKE  <Pattern> starName name birthdate ‘%1960’ MovieStar http://ecomputernotes.com
Compiler Optimization Common subexpression: (f+d*e)+((d*e+f)*g) f e + d g * + + d * * e f http://ecomputernotes.com
Compiler Optimization (Common subexpression: (f+d*e)+((d*e+f)*g) f e + d g * + * Graph! http://ecomputernotes.com

More Related Content

Viewers also liked

computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4
ecomputernotes
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20
ecomputernotes
 
computer notes - Data Structures - 14
computer notes - Data Structures - 14computer notes - Data Structures - 14
computer notes - Data Structures - 14
ecomputernotes
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15
ecomputernotes
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13
ecomputernotes
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3
ecomputernotes
 
computer notes - Data Structures - 10
computer notes - Data Structures - 10computer notes - Data Structures - 10
computer notes - Data Structures - 10
ecomputernotes
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
ecomputernotes
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11
ecomputernotes
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19
ecomputernotes
 
computer notes - Data Structures - 33
computer notes - Data Structures - 33computer notes - Data Structures - 33
computer notes - Data Structures - 33
ecomputernotes
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39
ecomputernotes
 
computer notes - Data Structures - 7
computer notes - Data Structures - 7computer notes - Data Structures - 7
computer notes - Data Structures - 7
ecomputernotes
 
computer notes - Data Structures - 2
computer notes - Data Structures - 2computer notes - Data Structures - 2
computer notes - Data Structures - 2
ecomputernotes
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32
ecomputernotes
 
computer notes - Data Structures - 1
computer notes - Data Structures - 1computer notes - Data Structures - 1
computer notes - Data Structures - 1
ecomputernotes
 
computer notes - Data Structures - 27
computer notes - Data Structures - 27computer notes - Data Structures - 27
computer notes - Data Structures - 27
ecomputernotes
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28
ecomputernotes
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
ecomputernotes
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35
ecomputernotes
 

Viewers also liked (20)

computer notes - Data Structures - 4
computer notes - Data Structures - 4computer notes - Data Structures - 4
computer notes - Data Structures - 4
 
computer notes - Data Structures - 20
computer notes - Data Structures - 20computer notes - Data Structures - 20
computer notes - Data Structures - 20
 
computer notes - Data Structures - 14
computer notes - Data Structures - 14computer notes - Data Structures - 14
computer notes - Data Structures - 14
 
computer notes - Data Structures - 15
computer notes - Data Structures - 15computer notes - Data Structures - 15
computer notes - Data Structures - 15
 
computer notes - Data Structures - 13
computer notes - Data Structures - 13computer notes - Data Structures - 13
computer notes - Data Structures - 13
 
computer notes - Data Structures - 3
computer notes - Data Structures - 3computer notes - Data Structures - 3
computer notes - Data Structures - 3
 
computer notes - Data Structures - 10
computer notes - Data Structures - 10computer notes - Data Structures - 10
computer notes - Data Structures - 10
 
computer notes - Data Structures - 8
computer notes - Data Structures - 8computer notes - Data Structures - 8
computer notes - Data Structures - 8
 
computer notes - Data Structures - 11
computer notes - Data Structures - 11computer notes - Data Structures - 11
computer notes - Data Structures - 11
 
computer notes - Data Structures - 19
computer notes - Data Structures - 19computer notes - Data Structures - 19
computer notes - Data Structures - 19
 
computer notes - Data Structures - 33
computer notes - Data Structures - 33computer notes - Data Structures - 33
computer notes - Data Structures - 33
 
computer notes - Data Structures - 39
computer notes - Data Structures - 39computer notes - Data Structures - 39
computer notes - Data Structures - 39
 
computer notes - Data Structures - 7
computer notes - Data Structures - 7computer notes - Data Structures - 7
computer notes - Data Structures - 7
 
computer notes - Data Structures - 2
computer notes - Data Structures - 2computer notes - Data Structures - 2
computer notes - Data Structures - 2
 
computer notes - Data Structures - 32
computer notes - Data Structures - 32computer notes - Data Structures - 32
computer notes - Data Structures - 32
 
computer notes - Data Structures - 1
computer notes - Data Structures - 1computer notes - Data Structures - 1
computer notes - Data Structures - 1
 
computer notes - Data Structures - 27
computer notes - Data Structures - 27computer notes - Data Structures - 27
computer notes - Data Structures - 27
 
computer notes - Data Structures - 28
computer notes - Data Structures - 28computer notes - Data Structures - 28
computer notes - Data Structures - 28
 
computer notes - Data Structures - 9
computer notes - Data Structures - 9computer notes - Data Structures - 9
computer notes - Data Structures - 9
 
computer notes - Data Structures - 35
computer notes - Data Structures - 35computer notes - Data Structures - 35
computer notes - Data Structures - 35
 

Similar to computer notes - Data Structures - 22 (6)

Computernotes datastructures-22-111227202516-phpapp02
Computernotes datastructures-22-111227202516-phpapp02Computernotes datastructures-22-111227202516-phpapp02
Computernotes datastructures-22-111227202516-phpapp02
 
Sienna6bst 120411102353-phpapp02
Sienna6bst 120411102353-phpapp02Sienna6bst 120411102353-phpapp02
Sienna6bst 120411102353-phpapp02
 
Computer notes - The const Keyword
Computer notes - The const KeywordComputer notes - The const Keyword
Computer notes - The const Keyword
 
Avl tree tutorial
Avl tree tutorialAvl tree tutorial
Avl tree tutorial
 
Sienna 6 bst
Sienna 6 bstSienna 6 bst
Sienna 6 bst
 
Computer notes - Mergesort
Computer notes - MergesortComputer notes - Mergesort
Computer notes - Mergesort
 

More from ecomputernotes

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30
ecomputernotes
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraints
ecomputernotes
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functions
ecomputernotes
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueries
ecomputernotes
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objects
ecomputernotes
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueries
ecomputernotes
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functions
ecomputernotes
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16
ecomputernotes
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36
ecomputernotes
 
Computer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY ClauseComputer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY Clause
ecomputernotes
 
Computer notes - Manipulating Data
Computer notes - Manipulating DataComputer notes - Manipulating Data
Computer notes - Manipulating Data
ecomputernotes
 
Computer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT StatementsComputer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT Statements
ecomputernotes
 
computer notes - Data Structures - 5
computer notes - Data Structures - 5computer notes - Data Structures - 5
computer notes - Data Structures - 5
ecomputernotes
 
Computer notes - Controlling User Access
Computer notes - Controlling User AccessComputer notes - Controlling User Access
Computer notes - Controlling User Access
ecomputernotes
 
Computer notes - Using SET Operator
Computer notes - Using SET OperatorComputer notes - Using SET Operator
Computer notes - Using SET Operator
ecomputernotes
 
computer notes - Data Structures - 38
computer notes - Data Structures - 38computer notes - Data Structures - 38
computer notes - Data Structures - 38
ecomputernotes
 
computer notes - Data Structures - 25
computer notes - Data Structures - 25computer notes - Data Structures - 25
computer notes - Data Structures - 25
ecomputernotes
 

More from ecomputernotes (17)

computer notes - Data Structures - 30
computer notes - Data Structures - 30computer notes - Data Structures - 30
computer notes - Data Structures - 30
 
Computer notes - Including Constraints
Computer notes - Including ConstraintsComputer notes - Including Constraints
Computer notes - Including Constraints
 
Computer notes - Date time Functions
Computer notes - Date time FunctionsComputer notes - Date time Functions
Computer notes - Date time Functions
 
Computer notes - Subqueries
Computer notes - SubqueriesComputer notes - Subqueries
Computer notes - Subqueries
 
Computer notes - Other Database Objects
Computer notes - Other Database ObjectsComputer notes - Other Database Objects
Computer notes - Other Database Objects
 
Computer notes - Advanced Subqueries
Computer notes -   Advanced SubqueriesComputer notes -   Advanced Subqueries
Computer notes - Advanced Subqueries
 
Computer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group FunctionsComputer notes - Aggregating Data Using Group Functions
Computer notes - Aggregating Data Using Group Functions
 
computer notes - Data Structures - 16
computer notes - Data Structures - 16computer notes - Data Structures - 16
computer notes - Data Structures - 16
 
computer notes - Data Structures - 36
computer notes - Data Structures - 36computer notes - Data Structures - 36
computer notes - Data Structures - 36
 
Computer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY ClauseComputer notes - Enhancements to the GROUP BY Clause
Computer notes - Enhancements to the GROUP BY Clause
 
Computer notes - Manipulating Data
Computer notes - Manipulating DataComputer notes - Manipulating Data
Computer notes - Manipulating Data
 
Computer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT StatementsComputer notes - Writing Basic SQL SELECT Statements
Computer notes - Writing Basic SQL SELECT Statements
 
computer notes - Data Structures - 5
computer notes - Data Structures - 5computer notes - Data Structures - 5
computer notes - Data Structures - 5
 
Computer notes - Controlling User Access
Computer notes - Controlling User AccessComputer notes - Controlling User Access
Computer notes - Controlling User Access
 
Computer notes - Using SET Operator
Computer notes - Using SET OperatorComputer notes - Using SET Operator
Computer notes - Using SET Operator
 
computer notes - Data Structures - 38
computer notes - Data Structures - 38computer notes - Data Structures - 38
computer notes - Data Structures - 38
 
computer notes - Data Structures - 25
computer notes - Data Structures - 25computer notes - Data Structures - 25
computer notes - Data Structures - 25
 

Recently uploaded

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

computer notes - Data Structures - 22

  • 1. Class No.22 Data Structures http://ecomputernotes.com
  • 2.
  • 3. Deletion in AVL Tree Case 1a : the parent of the deleted node had a balance of 0 and the node was deleted in the parent’s left subtree. Action : change the balance of the parent node and stop. No further effect on balance of any higher node. Delete on this side http://ecomputernotes.com
  • 4. Deletion in AVL Tree Here is why; the height of left tree does not change. 1 2 3 4 5 6 7 0 1 2 http://ecomputernotes.com
  • 5. Deletion in AVL Tree Here is why; the height of left tree does not change. 1 2 3 4 5 6 7 2 3 4 5 6 7 0 1 2 remove(1) http://ecomputernotes.com
  • 6. Deletion in AVL Tree Case 1b : the parent of the deleted node had a balance of 0 and the node was deleted in the parent’s right subtree. Action : (same as 1a ) change the balance of the parent node and stop. No further effect on balance of any higher node. Delete on this side http://ecomputernotes.com
  • 7. Deletion in AVL Tree Case 2a : the parent of the deleted node had a balance of 1 and the node was deleted in the parent’s left subtree. Action : change the balance of the parent node. May have caused imbalance in higher nodes so continue up the tree. Delete on this side http://ecomputernotes.com
  • 8. Deletion in AVL Tree Case 2b : the parent of the deleted node had a balance of -1 and the node was deleted in the parent’s right subtree. Action : same as 2a: change the balance of the parent node. May have caused imbalance in higher nodes so continue up the tree. Delete on this side http://ecomputernotes.com
  • 9. Deletion in AVL Tree Case 3a : the parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was balanced. http://ecomputernotes.com
  • 10. Deletion in AVL Tree Case 3a : the parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was balanced. Action : perform single rotation, adjust balance. No effect on balance of higher nodes so stop here. Single rotate http://ecomputernotes.com
  • 11. Deletion in AVL Tree Case 4a : parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was unbalanced. http://ecomputernotes.com
  • 12. Deletion in AVL Tree Case 4a : parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was unbalanced. Action : Double rotation at B. May have effected the balance of higher nodes, so continue up the tree. rotate double
  • 13. Deletion in AVL Tree Case 5a : parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was unbalanced. http://ecomputernotes.com
  • 14. Deletion in AVL Tree Case 5a : parent had balance of -1 and the node was deleted in the parent’s left subtree, right subtree was unbalanced. Action : Single rotation at B. May have effected the balance of higher nodes, so continue up the tree. rotate single
  • 15. Other Uses of Binary Trees Expression Trees http://ecomputernotes.com
  • 16.
  • 17. Expression Tree (a+b*c)+((d*e+f)*g) a c + b g * + + d * * e f http://ecomputernotes.com
  • 18.
  • 19. Parse Tree for an SQL query Consider querying a movie database Find the titles for movies with stars born in 1960 The database has tables StarsIn(title, year, starName) MovieStar(name, address, gender, birthdate) SELECT title FROM StarsIn, MovieStar WHERE starName = name AND birthdate LIKE ‘%1960’ ; http://ecomputernotes.com
  • 20. SQL Parse Tree < Query > SELECT <SelList> FROM <FromList> WHERE <Condition> <Attribute> <RelName> , <FromList> AND title StarsIn <RelName> <Condition> <Condition> <Attribute> = <Attribute> <Attribute> LIKE <Pattern> starName name birthdate ‘%1960’ MovieStar http://ecomputernotes.com
  • 21. Compiler Optimization Common subexpression: (f+d*e)+((d*e+f)*g) f e + d g * + + d * * e f http://ecomputernotes.com
  • 22. Compiler Optimization (Common subexpression: (f+d*e)+((d*e+f)*g) f e + d g * + * Graph! http://ecomputernotes.com

Editor's Notes

  1. Start of lecture 24
  2. End of lecture 23.
  3. End of lecture 24.